Sample 6 Photos with HicEst




Describe() FUNCTION Describe() DLG(TI='A simple picture viewer', Button='#Help', Button='OK')

#Help This little script runs on HicEst.exe for Windows. . View photos in a gallery . Find photos with text in title . Change size of the gallery . Single pictures from gallery . zoom single pictures . random selection . include/exclude sub-folders . remember rotation state . creation date and time, . title your photos. Single screen upsize photo: . Left mouse click on a gallery (=collection) photo Zoom SINGLE photo: . right mouse clicks, unzoom: Alt+right mouse clicks Back to gallery: . Left mouse click Forward n(gallery) pictures . Control + left mouse click Back n(gallery) pictures . Shift + left mouse click Drive, directory, find, rows, columns, random, all titles, exit . Right mouse click Rotate photo, change single title, copy image to directory . Control + Right mouse click opens options
TIME(Textout=$Date_Time) EDIT(Text=$Date_Time, Repeat=2, Right=':', Del=1, Ins='-') $titles = $AppDataPath & '\PhotoTitles.txt' $SaveLoadFile=$AppDataPath & '\PhotoSetting' SET($allPhotosCount=0, $baseDir=' ', $Dirs='C:\ProgramData\HicEst\PhotoDirs.txt', $find=' ', $clone=' ', $galleryRows = 3, $galleryCols = 3, $imgSel = '*.jpg', $photo1=0, $rand=' ', $sdir=' ', $subs=0) FILE(DRive=drives, FileDELete=$Dirs, FileDELete=$Titles) ARRAY(CSV=drives, NewLine=',', Name=$drvMtx) FILE(Name=$SaveLoadFile, EXISTs=existing) IF(existing) IF(1 == MSG(T='Continue last session?', Icon='?', Button='YesNoCancel')) LOAD($SaveLoadFile, $allPhotosCount, $baseDir, $find, $galleryRows, $galleryCols, $photo1, $subs, $rand) $photo1 = MAX(1, $photo1 - $galleryRows * $galleryCols) FILE(Name=$baseDir &'\'& $imgSel, Subdirs=$subs, ListFiles=$titles, Count=$allPhotosCount) ShowImages() ENDIF ENDIF FILE(DRive=drives, FileDELete=$Dirs, FileDELete=$Titles) ARRAY(CSV=drives, NewLine=',', Name=$drvMtx) DLG(LBL='First select a drive', B=$drvMtx) $baseDir = $txtRC GetDirectory() END FUNCTION GetDirectory() Images($) = ('*.jpg', '*.jpeg', '*.png', '*.bmp', '*.gif', '*.ico', '*.wdp', '*.tiff') DO FILE(FileDELete=$Dirs, FileDELete=$Titles) ! delete 2 files FILE(Dir=$baseDir, ListDirs=$Dirs, CouNT=nDirs) ! new base dir listing FILE(Name=$Dirs, AppendText=$drvMtx) ! save base dir and drives ARRAY(CSV=$Dirs, Name=DirMtx) FILE(Name=$baseDir &'\'& $imgSel, SubDirs=0, ListFiles=$Titles, Count=$allPhotosCount) IF($allPhotosCount == 0) DLG(LBL=$baseDir & '(no photos)',BG=99,X=0, B=DirMtx, LBL='Type',Y=-99,BG=99, RADio=Images,Val=$imgSel) $baseDir = $txtRC ELSE parent = $baseDir EDIT(Text=$baseDir, M1=0, R=999, L='\', M2=-1, CoPyto=parent) ARRAY(CSV=$Titles, Name=TitMtx) DLG(TI=$allPhotosCount && 'photos found', LBL='Directory',BG=99, B=$baseDir, B=parent,BG=900, B=DirMtx, LBL='Select start photo in' && $baseDir,Y=-999,BG=99, B=TitMtx) answer = $txtRC IF( INDEX(answer, '.') > 0) EDIT(T=answer, M1=0, R=999, L='\', M2=-1, CoPyto=dir, M1=2, R='.', M2=-1, CoPyto=filNam, M1=1, M2=999, CoPyto=ext) FILE(Name=answer, GetFileDir=$baseDir) FILE(Name=$titles, Text=filNam, FoundinRow=$photo1) ShowImages() ELSE $baseDir = $txtRC ENDIF ENDIF ENDDO END FUNCTION ShowImages() DO ii = 1, 1E9 SORT(Sort=$titles, Column=1) galleryCount = $galleryRows * $galleryCols ARRAY(Name=gallery, CLeaR=1) DO row = 1, $galleryRows ! set titles of gallery fotos DO col = 1, $galleryCols IF($rand == ' ') photoNr = col + $galleryCols * (row - 1) + $photo1 - 1 ELSE photoNr = CEILING(RAN($allPhotosCount)) ENDIF IF(photoNr <= $allPhotosCount) FILE(Name=$titles, Row=photoNr, RowToText=title) ENDIF gallery(row,col) = title ENDDO ENDDO SAVE($SaveLoadFile, $allPhotosCount, $baseDir, $find, $galleryRows, $galleryCols, $photo1, $subs, $rand) DLG(W=1,H=1, BG=0, image=gallery) photoNr = $C + $galleryCols * ($R - 1) + $photo1 - 1 kar = KEY('shift control right') !!!!!!!!DLG(L=0,W=1,T=0.95, TI=' ',B='control', B='shift',Y=0,X=1, B='right') ... kar = $TxtRC DLG(Size=500, B=' OK ') IF(INDEX(kar, 'CONTROL RIGHT')) rotateTxts($) = ('rotR = 90° right','rotU = 180°','rotL = 90° left','rot0 = no rotation') FILE(Name=$titles, Row=photoNr, RowToText=$path) FILE(Name=$path, GetFileDir=dir, GetFileName=oldName, GetFileExtension=ext) temp = oldName DO newName = temp rotateTxt = ' ' DLG(TItle='Change of photo title', E=oldName,X=0,RO=1,SYM,W=2, LBL='You may clone|parts of the|selected title', E=$clone,ReadOnly=1,BG=99,Y=0,X=1, LBL='You may select|a|rotation',X=-9, LB=rotateTxts,H=1/7,Value=rotateTxt,BG=99, E=newName,X=-9,SYM,W=2, B='do nothing',X=-9, B='CHANGE', B='Copy image to directory = PhotosCopiedOn' && $Date_Time,Y=19,X=-9,W=2) IF(temp > ' ') IF((rotateTxt > ' ')) EDIT(T=temp, DEL=' rotR', DEL=' rotU', DEL=' rotL', DEL=' rot0' ) IF(INDEX(rotateTxt, 'n') == 0) newName = temp && SUBSTRING(rotateTxt, 0, 4) IF(INDEX(rotateTxt, 'n') ) newName = temp EXIT ENDIF IF(newName == temp) EXIT ENDIF temp = newName ENDDO newName = dir & '\' & newName & ext IF($TxtRC == 'CHANGE') FILE(Name=newName, EXISTs=existing) IF(existing == 0) FILE(Name=$path, FileRenameTo=newName) FILE(Name=$titles, Text=$path, FoundinRow=found, DELeteRow=found) FILE(Name=$titles, Text=newName, TexttoRow=found) ELSE MSG(T=newName && 'exists already') ENDIF ELSEIF(SUBSTRING($TxtRC, 1, 4) == 'Copy') new = $AppDataPath & '\PhotosCopiedOn' && $Date_Time FILE(DIR=new) new = new & '\' & oldName & ext FILE(Name=$path, FileCopyToFile=new) ENDIF $photo1 = $photo1 - galleryCount ELSEIF(INDEX(kar, 'RIGHT')) IF($subs== 0) $sdir = ' ;' IF($subs ~ 0) $sdir = ' ;With subdirs' oldSubdirs = $subs oldFind = $find DLG(TItle=$TXT, LBL=$allPhotosCount && 'photos in' && dir && 'with $find=' && $find,BG=90, B='DIRECTORIES', B='DRIVE', E=$find,SYMB, NE=$galleryRows,SYMB, NE=$galleryCols,SYMB, NE=$photo1,SYMB, CHK='Random',Val=$rand, CHK='With subdirs', Val=$sdir, B='Date/Time: set ALL image titles in directory', B='OK', B='Exit HicEst') $subs = ($sdir ~ ' ;') IF( $txtRC == 'Date/Time: set ALL image titles in directory') SetDatesAndTimes() ELSEIF( $txtRC == 'DIRECTORIES') $find = '' FILE(Name=$titles, Row=1, RowToText=title) drive = SUBSTRING(title, 1, 3) GetDirectory() ELSEIF( $txtRC == 'DRIVE') $find = '' Describe() ELSEIF(($find > ' ') + (oldFind > ' ')) FILE(fileDelete=$titles, Name=$baseDir & '\*' & $find & '*', SubDirs=$subs, ListFiles=$titles, Count=$allPhotosCount) IF($allPhotosCount <= 0) MSG(T='No image titles with||' && $find && '||found in' && $baseDir) FILE(Name=$baseDir & '\' & $imgSel, SubDirs=$subs, ListFiles=$titles, Count=$allPhotosCount) ENDIF $photo1 = 1 ShowImages() ELSEIF( $txtRC == 'Exit HicEst') SYSTEM(Quit=1) ELSEIF($subs ~ oldSubDirs) $find = '' FILE(Name=$baseDir & '\' & $imgSel, SubDirs=$subs, ListFiles=$titles, Count=$allPhotosCount) ENDIF ENDIF IF(INDEX(kar, 'CONTROL')) IF($photo1 > 0) $photo1 = $photo1 + galleryCount ELSEIF(INDEX(kar, 'SHIFT')) IF($photo1 > 0) $photo1 = $photo1 - galleryCount ENDIF $photo1 = MAX(1, MIN($allPhotosCount - galleryCount + 1, $photo1)) ENDDO END FUNCTION SetDatesAndTimes() SET(changed=0, uTime=" ") DO img = 1, 1000 FILE(Name=$titles, Row=img, RowToText=$path) FILE(Name=$path, GetFileName=name, GetFileDir=dir, GetFileExtension=ext, GetImageTime=iTime) IF( LEN(name) < 20 ) ! eg .."\2024-11-01".. or .."\20241101".. IF(uTime == " ") input = 'DD.MM.YYYY hh:mm:ss' DLG(LBL=iTime,SYM, E=input,SYM, LBL='If necessary change "input"',BG=900, B='OK') ENDIF TIME(Pattern=input, Input=iTime, Pattern='YYYY-MM-DD hh-mm-', TextOut=uTime) IF(uTime(1) ~ ' ') new = dir & '\' & uTime & FMT(img, 'D3') & ' rotR' & ext FILE(Name=new, EXISTs=yes) IF(yes == 0) FILE(Name=$path, FileRenameTo=new) changed = changed + (yes == 0) ENDIF ENDIF ENDDO IF(changed) GetDirectory() END